package com.framework.model.common;

import com.framework.common.annotation.QueryParam;
import com.framework.common.model.validation.ValidationGroup;
import com.framework.common.util.other.NumeralUtil;
import com.framework.model.base.BaseModel;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * @author 龘鵺
 * @version 1.0
 * @className com.framework.model.common.Annex
 * @title 附件类
 * @datetime 2024-07-05 17:01:06
 */
public class Annex extends BaseModel implements Serializable {
    /**
     * 启用状态=1启用,2禁用 ENABLE_STATUS
     */
    @NotNull(message = "请选择启用状态", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Min(message = "启用状态错误", value = NumeralUtil.POSITIVE_ONE, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Max(message = "启用状态错误", value = Integer.MAX_VALUE, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @QueryParam(name = "enableStatus", code = "p.ENABLE_STATUS")
    private Integer enableStatus;

    /**
     * 所属编号 GROUP_ID
     */
    @NotNull(message = "请选择所属编号", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Min(message = "所属编号不存在", value = NumeralUtil.POSITIVE_ONE, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Max(message = "所属编号不存在", value = Long.MAX_VALUE, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @QueryParam(name = "groupId", code = "p.GROUP_ID")
    private Long groupId;

    /**
     * 分组代码 GROUP_CODE
     */
    @NotBlank(message = "请输入分组代码", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Size(message = "分组代码最多255字符", max = 255, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @QueryParam(name = "groupCode", code = "p.GROUP_CODE")
    private String groupCode;

    /**
     * 原始文件名 OLD_NAME
     */
    @NotBlank(message = "请输入原始文件名", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Size(message = "原始文件名最多255字符", max = 255, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @QueryParam(name = "oldName", code = "p.OLD_NAME")
    private String oldName;

    /**
     * 后缀名 SUFFIX
     */
    @NotBlank(message = "请输入后缀名", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Size(message = "后缀名最多16字符", max = 16, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @QueryParam(name = "suffix", code = "p.SUFFIX")
    private String suffix;

    /**
     * 新文件名 NEW_NAME
     */
    @NotBlank(message = "请输入新文件名", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Size(message = "新文件名最多255字符", max = 255, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @QueryParam(name = "newName", code = "p.NEW_NAME")
    private String newName;

    /**
     * 文件类型 (100=image， 1000=doc， 2000=excel， 3000=ppt， 4000=pdf) ANNEX_TYPE
     */
    @NotNull(message = "请选择文件类型", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Min(message = "文件类型错误", value = NumeralUtil.POSITIVE_ONE, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Max(message = "文件类型错误", value = Integer.MAX_VALUE, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @QueryParam(name = "annexType", code = "p.ANNEX_TYPE")
    private Integer annexType;

    /**
     * 文件路径 PATH
     */
    @NotBlank(message = "请输入文件路径", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Size(message = "文件路径最多512字符", max = 512, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @QueryParam(name = "path", code = "p.PATH")
    private String path;

    /**
     * 描述 DESCRIPTION
     */
    @NotBlank(message = "请输入描述", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Size(message = "描述最多2000字符", max = 2000, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @QueryParam(name = "description", code = "p.DESCRIPTION")
    private String description;

    /**
     * 关联状态 RELATION_STATUS
     */
    @NotNull(message = "请选择关联状态", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Min(message = "关联状态错误", value = NumeralUtil.POSITIVE_ONE, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Max(message = "关联状态错误", value = Integer.MAX_VALUE, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @QueryParam(name = "relationStatus", code = "p.RELATION_STATUS")
    private Integer relationStatus;

    /**
     * t_annex
     */
    private static final long serialVersionUID = 1L;

    public Integer getEnableStatus() {
        return enableStatus;
    }

    public void setEnableStatus(Integer enableStatus) {
        this.enableStatus = enableStatus;
    }

    public Long getGroupId() {
        return groupId;
    }

    public void setGroupId(Long groupId) {
        this.groupId = groupId;
    }

    public String getGroupCode() {
        return groupCode;
    }

    public void setGroupCode(String groupCode) {
        this.groupCode = groupCode == null ? null : groupCode.trim();
    }

    public String getOldName() {
        return oldName;
    }

    public void setOldName(String oldName) {
        this.oldName = oldName == null ? null : oldName.trim();
    }

    public String getSuffix() {
        return suffix;
    }

    public void setSuffix(String suffix) {
        this.suffix = suffix == null ? null : suffix.trim();
    }

    public String getNewName() {
        return newName;
    }

    public void setNewName(String newName) {
        this.newName = newName == null ? null : newName.trim();
    }

    public Integer getAnnexType() {
        return annexType;
    }

    public void setAnnexType(Integer annexType) {
        this.annexType = annexType;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path == null ? null : path.trim();
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description == null ? null : description.trim();
    }

    public Integer getRelationStatus() {
        return relationStatus;
    }

    public void setRelationStatus(Integer relationStatus) {
        this.relationStatus = relationStatus;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", enableStatus=").append(enableStatus);
        sb.append(", groupId=").append(groupId);
        sb.append(", groupCode=").append(groupCode);
        sb.append(", oldName=").append(oldName);
        sb.append(", suffix=").append(suffix);
        sb.append(", newName=").append(newName);
        sb.append(", annexType=").append(annexType);
        sb.append(", path=").append(path);
        sb.append(", description=").append(description);
        sb.append(", relationStatus=").append(relationStatus);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Annex other = (Annex) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getCreateId() == null ? other.getCreateId() == null : this.getCreateId().equals(other.getCreateId()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getOperaterId() == null ? other.getOperaterId() == null : this.getOperaterId().equals(other.getOperaterId()))
            && (this.getOperaterTime() == null ? other.getOperaterTime() == null : this.getOperaterTime().equals(other.getOperaterTime()))
            && (this.getOperaterStatus() == null ? other.getOperaterStatus() == null : this.getOperaterStatus().equals(other.getOperaterStatus()))
            && (this.getEnableStatus() == null ? other.getEnableStatus() == null : this.getEnableStatus().equals(other.getEnableStatus()))
            && (this.getGroupId() == null ? other.getGroupId() == null : this.getGroupId().equals(other.getGroupId()))
            && (this.getGroupCode() == null ? other.getGroupCode() == null : this.getGroupCode().equals(other.getGroupCode()))
            && (this.getOldName() == null ? other.getOldName() == null : this.getOldName().equals(other.getOldName()))
            && (this.getSuffix() == null ? other.getSuffix() == null : this.getSuffix().equals(other.getSuffix()))
            && (this.getNewName() == null ? other.getNewName() == null : this.getNewName().equals(other.getNewName()))
            && (this.getAnnexType() == null ? other.getAnnexType() == null : this.getAnnexType().equals(other.getAnnexType()))
            && (this.getPath() == null ? other.getPath() == null : this.getPath().equals(other.getPath()))
            && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()))
            && (this.getRelationStatus() == null ? other.getRelationStatus() == null : this.getRelationStatus().equals(other.getRelationStatus()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getCreateId() == null) ? 0 : getCreateId().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getOperaterId() == null) ? 0 : getOperaterId().hashCode());
        result = prime * result + ((getOperaterTime() == null) ? 0 : getOperaterTime().hashCode());
        result = prime * result + ((getOperaterStatus() == null) ? 0 : getOperaterStatus().hashCode());
        result = prime * result + ((getEnableStatus() == null) ? 0 : getEnableStatus().hashCode());
        result = prime * result + ((getGroupId() == null) ? 0 : getGroupId().hashCode());
        result = prime * result + ((getGroupCode() == null) ? 0 : getGroupCode().hashCode());
        result = prime * result + ((getOldName() == null) ? 0 : getOldName().hashCode());
        result = prime * result + ((getSuffix() == null) ? 0 : getSuffix().hashCode());
        result = prime * result + ((getNewName() == null) ? 0 : getNewName().hashCode());
        result = prime * result + ((getAnnexType() == null) ? 0 : getAnnexType().hashCode());
        result = prime * result + ((getPath() == null) ? 0 : getPath().hashCode());
        result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
        result = prime * result + ((getRelationStatus() == null) ? 0 : getRelationStatus().hashCode());
        return result;
    }
}